<template>
  <el-table
      @row-click="rowClick"
      :data="songList"
      style="width: 900px;margin:0 auto">
    <el-table-column
        prop="songID"
        label="歌曲ID">
    </el-table-column>
    <el-table-column
        prop="songName"
        label="歌曲名">
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: "HotMusic",
  data() {
    return {
      songList: []
    }
  },
  created() {
    this.$axios.get('/top/song?type=7',
        {
          params: {keywords: this.song}
        }
    ).then(({data}) => {
          if (data.code === 200) {
            data.data.forEach(data => {
              const obj = {
                songID: data.id,
                songName: data.name
              }
              this.songList.push(obj);
            })
          }
        }
    )
  },
  methods: {
    rowClick(row) {
      console.log(row)
      this.$emit('getSongId', row.songID);
    }
  }
}
</script>

<style scoped>

</style>